<?php

/**
 * This is the model class for table "wx_source_data".
 *
 * The followings are the available columns in table 'wx_source_data':
 * @property string $id
 * @property string $ToUserName
 * @property string $FromUserName
 * @property integer $CreateTime
 * @property string $MsgType
 * @property string $Content
 * @property string $MsgId
 * @property string $MediaId
 * @property string $PicUrl
 * @property string $Format
 * @property string $ThumbMediaId
 * @property string $Label
 * @property double $Location_X
 * @property double $Location_Y
 * @property integer $Scale
 * @property string $Url
 * @property string $Title
 * @property string $Description
 * @property integer $process
 * @property string $localaddr
 * @property integer $wxsuid
 * @property string $recognition
 * @property string $create_time
 * @property string $update_time
 * @property string $created_by
 * @property string $updated_by
 * @property integer $is_delete
 */
class WxSourceData extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return WxSourceData the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'wx_source_data';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('CreateTime, Scale, process, wxsuid, is_delete', 'numerical', 'integerOnly'=>true),
			array('Location_X, Location_Y', 'numerical'),
			array('ToUserName, FromUserName, MsgType, MediaId, PicUrl, Format, ThumbMediaId, Url, Title, Description, localaddr, recognition, created_by, updated_by', 'length', 'max'=>255),
			array('MsgId', 'length', 'max'=>20),
			array('Content, Label, create_time, update_time', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, ToUserName, FromUserName, CreateTime, MsgType, Content, MsgId, MediaId, PicUrl, Format, ThumbMediaId, Label, Location_X, Location_Y, Scale, Url, Title, Description, process, localaddr, wxsuid, recognition, create_time, update_time, created_by, updated_by, is_delete', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'ToUserName' => 'To User Name',
			'FromUserName' => 'From User Name',
			'CreateTime' => 'Create Time',
			'MsgType' => 'Msg Type',
			'Content' => 'Content',
			'MsgId' => 'Msg',
			'MediaId' => 'Media',
			'PicUrl' => 'Pic Url',
			'Format' => 'Format',
			'ThumbMediaId' => 'Thumb Media',
			'Label' => 'Label',
			'Location_X' => 'Location X',
			'Location_Y' => 'Location Y',
			'Scale' => 'Scale',
			'Url' => 'Url',
			'Title' => 'Title',
			'Description' => 'Description',
			'process' => 'Process',
			'localaddr' => 'Localaddr',
			'wxsuid' => 'Wxsuid',
			'recognition' => 'Recognition',
			'create_time' => 'Create Time',
			'update_time' => 'Update Time',
			'created_by' => 'Created By',
			'updated_by' => 'Updated By',
			'is_delete' => 'Is Delete',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id,true);
		$criteria->compare('ToUserName',$this->ToUserName,true);
		$criteria->compare('FromUserName',$this->FromUserName,true);
		$criteria->compare('CreateTime',$this->CreateTime);
		$criteria->compare('MsgType',$this->MsgType,true);
		$criteria->compare('Content',$this->Content,true);
		$criteria->compare('MsgId',$this->MsgId,true);
		$criteria->compare('MediaId',$this->MediaId,true);
		$criteria->compare('PicUrl',$this->PicUrl,true);
		$criteria->compare('Format',$this->Format,true);
		$criteria->compare('ThumbMediaId',$this->ThumbMediaId,true);
		$criteria->compare('Label',$this->Label,true);
		$criteria->compare('Location_X',$this->Location_X);
		$criteria->compare('Location_Y',$this->Location_Y);
		$criteria->compare('Scale',$this->Scale);
		$criteria->compare('Url',$this->Url,true);
		$criteria->compare('Title',$this->Title,true);
		$criteria->compare('Description',$this->Description,true);
		$criteria->compare('process',$this->process);
		$criteria->compare('localaddr',$this->localaddr,true);
		$criteria->compare('wxsuid',$this->wxsuid);
		$criteria->compare('recognition',$this->recognition,true);
		$criteria->compare('create_time',$this->create_time,true);
		$criteria->compare('update_time',$this->update_time,true);
		$criteria->compare('created_by',$this->created_by,true);
		$criteria->compare('updated_by',$this->updated_by,true);
		$criteria->compare('is_delete',$this->is_delete);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}